//
// Created by amon.huang on 2021/9/11.
//

#ifndef AMONPLAYER_PUSH_H
#define AMONPLAYER_PUSH_H

#include "PushJNICall.h"

extern "C" {
#include "librtmp/include/rtmp.h"
};

class Push {
public:
    PushJNICall *pJniCall;
    char *pPushUrl;

    RTMP *pRTMP;
    PushPacketQueue *pPacketQueue;

    pthread_t initThreadId;
    long startTime;
    bool isPush = true;

public:
    Push(PushJNICall *pJniCall, const char *pushUrl);

    ~Push();

    void initConnect();

    void pushSpsPps(uint8_t *sps, uint16_t spsLength, uint8_t *pps, uint16_t ppsLength);

    void pushVideoData(uint8_t *videoData, int length, bool keyFrame);

    void pushAudioData(uint8_t *audioData, int dataLen);

    void stop();
};


#endif //AMONPLAYER_PUSH_H
